package com.jt.rescource.controller;

import com.jt.rescource.annotation.RequiredLog;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName ResourceController
 * @Description TODO
 * @Author Jiyao
 * @DATE 2021-11-29 15:01
 * @Version 1.0
 **/
@RestController
@RequestMapping("resource")
public class ResourceController {

    /**
     * @PreAuthorize("hasAnyAuthority('sys:res:list')")
     * @Date 15:13 2021/11/29
     * @Param []
     * @return java.lang.String
     **/
    @RequiredLog("获取资源")
    @PreAuthorize("hasAnyAuthority('sys:res:list')")
    @GetMapping
    public String doSelect(){
        return "select resource ok";
    }

    @PreAuthorize("hasAnyAuthority('sys:res:update')")
    @PostMapping
    public String doCreate(){
        return "create resource ok";
    }

    @PutMapping
    public String doUpdate(){
        return "update resource ok";
    }

    @DeleteMapping
    public String doDelete(){
        return "delete resource ok";
    }
}
